import oauth.signpost.OAuthConsumer;
import oauth.signpost.OAuthProvider;
import oauth.signpost.basic.DefaultOAuthConsumer;
import oauth.signpost.basic.DefaultOAuthProvider;
import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
import oauth.signpost.exception.OAuthCommunicationException;
import oauth.signpost.exception.OAuthExpectationFailedException;
import oauth.signpost.exception.OAuthMessageSignerException;
import oauth.signpost.exception.OAuthNotAuthorizedException;


public class TwitterTest2 {

	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String mConsumerKey = "CLYzYAeAgwBq9cPXzXWjg";
		String mSecretKey = "SOndT1quCUwl2HWW7QBnmgTnvrG5oLykUI4BJkhxLHk";
		String CALLBACK_URL = "twitterapp://connect";
		
		CommonsHttpOAuthConsumer mHttpOauthConsumer = new CommonsHttpOAuthConsumer(mConsumerKey, mSecretKey);
		
	    OAuthConsumer consumer = new DefaultOAuthConsumer(mConsumerKey, mSecretKey);
	    
		OAuthProvider mHttpOauthprovider = new DefaultOAuthProvider("https://api.twitter.com/oauth/request_token",
													 "https://api.twitter.com/oauth/access_token",
													 "https://api.twitter.com/oauth/authorize");
		
		try {
			String authUrl = mHttpOauthprovider.retrieveRequestToken(consumer, CALLBACK_URL);
			System.out.println("url : " + authUrl);
		} catch (OAuthMessageSignerException e) {
			e.printStackTrace();
		} catch (OAuthNotAuthorizedException e) {
			e.printStackTrace();
		} catch (OAuthExpectationFailedException e) {
			e.printStackTrace();
		} catch (OAuthCommunicationException e) {
			e.printStackTrace();
		}
		

	}

}
